package ModelLayer;

public class Tree {
	private String sort;
	private String lifespan;
	private float costPerSquareKilometer;
	private float revenuePerSquareKilometer;
	private float profit;
	/**
	 * Create tree
	 * @param String sort, String lifespan, float costPerSquareKilometer
	 * */
	public Tree(String sort, String lifespan, float cPSK){
		this.setSort(sort);
		this.setLifespan(lifespan);
		this.setCostPerSquareKilometer(cPSK);
	}
	//Get and set sort
	public String getSort() {
		return sort;
	}
	public void setSort(String sort) {
		this.sort = sort;
	}
	//Get and set sort
	public String getLifespan() {
		return lifespan;
	}
	public void setLifespan(String lifespan) {
		this.lifespan = lifespan;
	}
	//Get and set Cost per square kilometer
	public float getCostPerSquareKilometer() {
		return costPerSquareKilometer;
	}
	public void setCostPerSquareKilometer(float costPerSquareKilometer) {
		this.costPerSquareKilometer = costPerSquareKilometer;
	}
	
	//Set and get Revenue
	public float getRevenuePerSquareKilometer() {
		return revenuePerSquareKilometer;
	}
	public void setRevenuePerSquareKilometer(Forest forest) {
		Forest f = forest;
		float skm = f.getSquareMeter() / 1000;
		this.revenuePerSquareKilometer = skm * getCostPerSquareKilometer();
	}
	
	//Set and get cost
	public void setProfit(Forest forest){
		Forest f = forest;
		profit = f.getPrice() - this.revenuePerSquareKilometer;
	}
	public float getProfit(){
		return profit;
	}
}
